Skip to content

feat: add statuspage migration commands#1

Merged
debidong merged 4 commits intomainfrom
codex/statuspage-migrate-cli
Apr 20, 2026
Merged

feat: add statuspage migration commands#1
debidong merged 4 commits intomainfrom
codex/statuspage-migrate-cli

Conversation

@debidong
Copy link
Copy Markdown
Collaborator

Summary

  • add async statuspage migration commands for structure, email-subscribers, status, and cancel
  • implement CLI-local migration transport and command tests without waiting on a flashduty-sdk release
  • document the new migration workflow and save the implementation plan

Test Plan

  • go test ./internal/cli
  • go test ./...
  • go build ./cmd/flashduty

Resolve conflicts in .gitignore, internal/cli/root.go, and
internal/cli/status_page.go. Keep main's three-group goimports layout
and newClientFn factory pattern; add PR's loadResolvedConfig helper
(consumed by status_page_migrate.go) and reuse it from defaultNewClient
to avoid duplicating flag-override logic. Keep PR's README expansion
for the statuspage section; drop PR's docs/superpowers/ gitignore in
favor of main's broader docs/ rule.
@debidong debidong merged commit bf81170 into main Apr 20, 2026
12 checks passed
@debidong debidong deleted the codex/statuspage-migrate-cli branch April 20, 2026 07:57
debidong added a commit that referenced this pull request Apr 20, 2026
Replaces the CLI-local raw-HTTP transport introduced by #1 with the
flashduty-sdk v0.7.0 methods and routes the 4 migrate subcommands
through the RunContext / runCommand pattern used by every other
command.

Changes:
- Bump flashduty-sdk from v0.6.0 to v0.7.0 (adds status page migration
  methods).
- Extend flashdutyClient interface with StartStatusPageMigration,
  StartStatusPageEmailSubscriberMigration, GetStatusPageMigrationStatus,
  CancelStatusPageMigration.
- Add default mockClient stubs for the four new interface methods.
- Rewrite internal/cli/status_page_migrate.go (~590 lines to ~280):
  delete statusPageMigrationAPI, statusPageMigrationService, the
  CLI-local migration transport, manual sanitization, and duplicate
  local types. Each cobra command now uses runCommand(cmd, args,
  func(ctx *RunContext) error {...}) and delegates to ctx.Client.*.
  Print helpers rewired from flagJSON / newPrinter() globals to
  ctx.JSON / ctx.Printer / ctx.Writer.
- Rewrite internal/cli/status_page_migrate_test.go (387 lines to ~340):
  replace httptest-backed transport tests with newClientFn mock-swap
  tests using execCommand, matching the pattern established in
  command_test.go. One httptest-backed integration test per SDK method
  is not kept here because the flashduty-sdk repo owns wire-format
  tests now.

Post-review fixes (independent reviews from go-reviewer + Codex):
- Nil-guard mock methods so tests overriding a subset do not panic.
- Assert "atlassian" substring in the unsupported-source error so the
  supported list cannot silently drift.
- Emit both "command" (PR #1 schema) and "next_command" in cancel
  --json output to preserve the shipped JSON contract.
- Move validateMigrationSource before runCommand so an invalid --from
  fails with the source error before any client/auth work, matching
  PR #1 ordering. Add two tests locking the ordering.

Command output and JSON schemas remain compatible with PR #1. The
file internal/cli/status_page_migrate.go is no longer an architectural
outlier: 100% of the CLI now flows through ctx.Client.

Verification:
- go test -race -count=1 ./... green
- go test -tags=e2e ./e2e/... green (24.4s)
- gofmt, goimports, go vet clean
- Coverage on ported commands: 80-100%.
debidong added a commit that referenced this pull request Apr 20, 2026
Replaces the CLI-local raw-HTTP transport introduced by #1 with the
flashduty-sdk v0.7.0 methods and routes the 4 migrate subcommands
through the RunContext / runCommand pattern used by every other
command.

Changes:
- Bump flashduty-sdk from v0.6.0 to v0.7.0 (adds status page migration
  methods).
- Extend flashdutyClient interface with StartStatusPageMigration,
  StartStatusPageEmailSubscriberMigration, GetStatusPageMigrationStatus,
  CancelStatusPageMigration.
- Add default mockClient stubs for the four new interface methods.
- Rewrite internal/cli/status_page_migrate.go (~590 lines to ~280):
  delete statusPageMigrationAPI, statusPageMigrationService, the
  CLI-local migration transport, manual sanitization, and duplicate
  local types. Each cobra command now uses runCommand(cmd, args,
  func(ctx *RunContext) error {...}) and delegates to ctx.Client.*.
  Print helpers rewired from flagJSON / newPrinter() globals to
  ctx.JSON / ctx.Printer / ctx.Writer.
- Rewrite internal/cli/status_page_migrate_test.go (387 lines to ~340):
  replace httptest-backed transport tests with newClientFn mock-swap
  tests using execCommand, matching the pattern established in
  command_test.go. One httptest-backed integration test per SDK method
  is not kept here because the flashduty-sdk repo owns wire-format
  tests now.

Post-review fixes (independent reviews from go-reviewer + Codex):
- Nil-guard mock methods so tests overriding a subset do not panic.
- Assert "atlassian" substring in the unsupported-source error so the
  supported list cannot silently drift.
- Emit both "command" (PR #1 schema) and "next_command" in cancel
  --json output to preserve the shipped JSON contract.
- Move validateMigrationSource before runCommand so an invalid --from
  fails with the source error before any client/auth work, matching
  PR #1 ordering. Add two tests locking the ordering.

Command output and JSON schemas remain compatible with PR #1. The
file internal/cli/status_page_migrate.go is no longer an architectural
outlier: 100% of the CLI now flows through ctx.Client.

Verification:
- go test -race -count=1 ./... green
- go test -tags=e2e ./e2e/... green (24.4s)
- gofmt, goimports, go vet clean
- Coverage on ported commands: 80-100%.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant